/* sodw.t SALES ORDER LINE WRITE TRIGGER                                      */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                         */
/*All rights reserved worldwide.  This is an unpublished work.                */
/* $Revision: 1.6 $                                                           */
/*V8:ConvertMode=NoConvert                                                    */
/******************************************************************************/
/*  !Description : sod_det WRITE trigger program                              */
/*          : In order to enhance this trigger to support additional          */
/*          : interfaces, add a DO-END block similar to the one               */
/*          : used for the Warehousing Interface to (1) check for the         */
/*          : need to continue processing; (2) move the relevant              */
/*          : fields to an appropriate work area; and (3) call                */
/*          : one or more subprograms to continue processing.                 */
/*          : This .t program should remain short, relying on                 */
/*          : subprograms to perform most of the work.                        */
/******************************************************************************/
/*                             MODIFY LOG                                     */
/******************************************************************************/
/*Revision 8.5          Last Modified:  03/14/96    BY: BHolmes *J0FY*        */
/*Revision 8.5          Last Modified:  06/25/96    BY: BHolmes *J0M9*        */
/*Revision 8.5          Last Modified:  07/19/96    BY: fwy     *J0MB*        */
/*Revision 8.5          Last Modified:  07/27/96    BY: fwy     *J12B*        */
/*Revision 8.5          Last Modified:  01/07/97    BY: jpm     *J1DM*        */
/*Revision 9.1          Last Modified:  08/12/00    BY: *N0KN* Mark Brown     */
/* Revision: 1.4        BY: Jean Miller          DATE: 06/13/02  ECO: *P082*  */
/* Revision: 1.5        BY: Jean Miller          DATE: 08/01/02  ECO: *P0CL*  */
/* $Revision: 1.6 $     BY: Jean Miller          DATE: 08/17/02  ECO: *P0FN*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

TRIGGER PROCEDURE FOR WRITE OF SOD_DET OLD BUFFER OLD_SOD_DET.

{mfdeclre.i }

define new shared work-table wf_old_sod_det like sod_det.
define new shared variable w-recid as recid.

define variable w-file as character format "x(24)".
define new shared variable w-site-loc-id like whl_mstr.whl_src_dest_id.

define variable l-qualifier as character format "x(8)".

/* Warehousing Interface processing */
WI:
do:

   /* If there is no active external warehouse that is flagged to
      receive sales order export transactions, then do not process */
   if not can-find(first whl_mstr no-lock
                   where whl_mstr.whl_act and whl_mstr.whl_so_exp)
   then leave WI.

   /* Do not process if multi-DB and in central database */
   find si_mstr no-lock where si_site = sod_det.sod_site no-error.
   if global_db <> "" and si_mstr.si_db <> global_db then leave WI.

   /* If no pertinent fields have been changed, then do not process */
   if (old_sod_det.sod_nbr      = sod_det.sod_nbr
      and old_sod_det.sod_line     = sod_det.sod_line
      and old_sod_det.sod_part     = sod_det.sod_part
      and old_sod_det.sod_custpart = sod_det.sod_custpart
      and old_sod_det.sod_desc     = sod_det.sod_desc
      and old_sod_det.sod_site     = sod_det.sod_site
      and old_sod_det.sod_loc      = sod_det.sod_loc
      and old_sod_det.sod_serial   = sod_det.sod_serial
      and old_sod_det.sod_due_date = sod_det.sod_due_date
      and old_sod_det.sod_qty_ord  = sod_det.sod_qty_ord
      and old_sod_det.sod_um       = sod_det.sod_um
      and old_sod_det.sod_um_conv  = sod_det.sod_um_conv
      and old_sod_det.sod_user1    = sod_det.sod_user1
      and old_sod_det.sod_user2    = sod_det.sod_user2
      and old_sod_det.sod_cmtindx  = sod_det.sod_cmtindx)
   then leave WI.

   /* Move old sod_det values to work table for subsequent processing */
   assign
      w-recid = recid(sod_det).

   create wf_old_sod_det.
   if recid(wf_old_sod_det)= -1 then .
   assign
      wf_old_sod_det.sod_nbr       = old_sod_det.sod_nbr
      wf_old_sod_det.sod_line      = old_sod_det.sod_line
      wf_old_sod_det.sod_part      = old_sod_det.sod_part
      wf_old_sod_det.sod_custpart  = old_sod_det.sod_custpart
      wf_old_sod_det.sod_desc      = old_sod_det.sod_desc
      wf_old_sod_det.sod_site      = old_sod_det.sod_site
      wf_old_sod_det.sod_loc       = old_sod_det.sod_loc
      wf_old_sod_det.sod_serial    = old_sod_det.sod_serial
      wf_old_sod_det.sod_due_date  = old_sod_det.sod_due_date
      wf_old_sod_det.sod_qty_ord   = old_sod_det.sod_qty_ord
      wf_old_sod_det.sod_um        = old_sod_det.sod_um
      wf_old_sod_det.sod_um_conv   = old_sod_det.sod_um_conv
      wf_old_sod_det.sod_user1     = old_sod_det.sod_user1
      wf_old_sod_det.sod_user2     = old_sod_det.sod_user2
      wf_old_sod_det.sod_cmtindx   = old_sod_det.sod_cmtindx.

   /* If the order quantity is being changed from - to +,
      then create a delete transaction first */
   if wf_old_sod_det.sod_qty_ord < 0
      and sod_det.sod_qty_ord >= 0
   then do:
      w-file = "wisodd.p".
      {gprunmo.i &module="WI"
         &program="wisodd.p"}
   end.

   /* If the line being added/changed has a negative quantity ordered,
      then create an add/change transaction */
   if sod_det.sod_qty_ord < 0
   then do:
      w-file = "wisodw2.p".
      {gprunmo.i &module="WI"
         &program="wisodw2.p"}
      leave WI.
   end.

   /* If the line being added/changed has a positive quantity ordered,
      then create an add/change transaction if there is a picked quantity */
   if sod_det.sod_qty_ord >= 0
   then do:
      w-file = "wisodw.p".
      {gprunmo.i &module="WI"
         &program="wisodw.p"}
   end.

end. /* WI */

/* Track Capacity Units */
if new sod_det and
  (old_sod_det.sod_nbr  <> sod_det.sod_nbr  or
   old_sod_det.sod_line <> sod_det.sod_line)
then do:

   l-qualifier = "".

   /* See if this is from SSM/PRM */
   if sod_det.sod_fsm_type <> "" then
      l-qualifier = sod_det.sod_fsm_type.

   /* Check if Scheduled Order Line */
   else
   if sod_det.sod_sched then
      l-qualifier = "SCHED".

   {lvucap.i &TABLE="sod_det" &QUALIFIER="l-qualifier"}

end.


/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "sod_det" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(sod_det), input "sod_det").

    if not can-find ( first dt_mstr where dt_table = "sod_det" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_sod_det ) then do:
        create wf_old_sod_det.
        if recid(wf_old_sod_det)= -1 then .
    end.
    
    buffer-copy old_sod_det to wf_old_sod_det no-error.

    for each dt_mstr no-lock where dt_table = "sod_det" and dt_type = "MOD" :
    
        case dt_field :

            when "sod_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_nbr, input sod_det.sod_nbr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_due_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_due_date), input string(sod_det.sod_due_date),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_per_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_per_date), input string(sod_det.sod_per_date),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_req_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_req_date), input string(sod_det.sod_req_date),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_line), input string(sod_det.sod_line),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_part, input sod_det.sod_part,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_ord" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_ord), input string(sod_det.sod_qty_ord),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_all" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_all), input string(sod_det.sod_qty_all),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_pick" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_pick), input string(sod_det.sod_qty_pick),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_ship" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_ship), input string(sod_det.sod_qty_ship),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_inv" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_inv), input string(sod_det.sod_qty_inv),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_loc, input sod_det.sod_loc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_type, input sod_det.sod_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_price), input string(sod_det.sod_price),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_std_cost" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_std_cost), input string(sod_det.sod_std_cost),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_chg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_chg), input string(sod_det.sod_qty_chg),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_bo_chg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_bo_chg), input string(sod_det.sod_bo_chg),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_acct, input sod_det.sod_acct,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_abnormal" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_abnormal), input string(sod_det.sod_abnormal),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_taxable" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_taxable), input string(sod_det.sod_taxable),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_serial" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_serial, input sod_det.sod_serial,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_desc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_desc, input sod_det.sod_desc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_um, input sod_det.sod_um,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_cc, input sod_det.sod_cc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_comment[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_comment[1], input sod_det.sod_comment[1],
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_lot" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_lot, input sod_det.sod_lot,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_um_conv" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_um_conv), input string(sod_det.sod_um_conv),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fa_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_fa_nbr, input sod_det.sod_fa_nbr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_disc_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_disc_pct), input string(sod_det.sod_disc_pct),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_project" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_project, input sod_det.sod_project,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cmtindx" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_cmtindx), input string(sod_det.sod_cmtindx),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_custpart" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_custpart, input sod_det.sod_custpart,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qad01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qad01), input string(sod_det.sod__qad01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_status" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_status, input sod_det.sod_status,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_xslspsn[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_xslspsn[1], input sod_det.sod_xslspsn[1],
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_xcomm_pct[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_xcomm_pct[1]), input string(sod_det.sod_xcomm_pct[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dsc_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_dsc_acct, input sod_det.sod_dsc_acct,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dsc_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_dsc_cc, input sod_det.sod_dsc_cc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_list_pr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_list_pr), input string(sod_det.sod_list_pr),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_user1, input sod_det.sod_user1,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_user2, input sod_det.sod_user2,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sob_rev" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sob_rev), input string(sod_det.sod_sob_rev),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sob_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sob_std), input string(sod_det.sod_sob_std),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_qote" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_qote), input string(sod_det.sod_qty_qote),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_consume" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_consume), input string(sod_det.sod_consume),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_expire" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_expire), input string(sod_det.sod_expire),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qad02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qad02), input string(sod_det.sod__qad02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_taxc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_taxc, input sod_det.sod_taxc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_inv_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_inv_nbr, input sod_det.sod_inv_nbr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_partial" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_partial), input string(sod_det.sod_partial),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_site, input sod_det.sod_site,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_prodline" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_prodline, input sod_det.sod_prodline,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_tax_in" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_tax_in), input string(sod_det.sod_tax_in),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fst_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fst_list), input string(sod_det.sod_fst_list),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pst" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_pst), input string(sod_det.sod_pst),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr01, input sod_det.sod__chr01,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr02, input sod_det.sod__chr02,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr03, input sod_det.sod__chr03,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr04, input sod_det.sod__chr04,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr05, input sod_det.sod__chr05,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr06, input sod_det.sod__chr06,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr07, input sod_det.sod__chr07,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr08, input sod_det.sod__chr08,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr09, input sod_det.sod__chr09,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__chr10, input sod_det.sod__chr10,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__dte01), input string(sod_det.sod__dte01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__dte02), input string(sod_det.sod__dte02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__dec01), input string(sod_det.sod__dec01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__dec02), input string(sod_det.sod__dec02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__log01), input string(sod_det.sod__log01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_calc_isb" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_calc_isb), input string(sod_det.sod_calc_isb),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_owner" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_owner, input sod_det.sod_owner,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_rma_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_rma_type, input sod_det.sod_rma_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_item" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_item), input string(sod_det.sod_qty_item),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_per" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_per), input string(sod_det.sod_qty_per),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_ref), input string(sod_det.sod_ref),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_for" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_for, input sod_det.sod_for,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_tax_max" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_tax_max), input string(sod_det.sod_tax_max),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_contr_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_contr_id, input sod_det.sod_contr_id,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pickdate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_pickdate), input string(sod_det.sod_pickdate),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_confirm" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_confirm), input string(sod_det.sod_confirm),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cum_qty[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_cum_qty[1]), input string(sod_det.sod_cum_qty[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cum_date[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_cum_date[1]), input string(sod_det.sod_cum_date[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_rate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fr_rate), input string(sod_det.sod_fr_rate),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_slspsn[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_slspsn[1], input sod_det.sod_slspsn[1],
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_comm_pct[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_comm_pct[1]), input string(sod_det.sod_comm_pct[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ord_mult" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_ord_mult), input string(sod_det.sod_ord_mult),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pkg_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_pkg_code, input sod_det.sod_pkg_code,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_curr_rlse_id[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_curr_rlse_id[1], input sod_det.sod_curr_rlse_id[1],
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sched" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sched), input string(sod_det.sod_sched),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sch_data" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_sch_data, input sod_det.sod_sch_data,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sch_mrp" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sch_mrp), input string(sod_det.sod_sch_mrp),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_rlse_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_rlse_nbr), input string(sod_det.sod_rlse_nbr),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_translt_days" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_translt_days), input string(sod_det.sod_translt_days),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fsm_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_fsm_type, input sod_det.sod_fsm_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_conrep" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_conrep, input sod_det.sod_conrep,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_start_eff[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_start_eff[1]), input string(sod_det.sod_start_eff[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_end_eff[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_end_eff[1]), input string(sod_det.sod_end_eff[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dock" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_dock, input sod_det.sod_dock,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pr_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_pr_list, input sod_det.sod_pr_list,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_translt_hrs" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_translt_hrs), input string(sod_det.sod_translt_hrs),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_out_po" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_out_po, input sod_det.sod_out_po,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_raw_days" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_raw_days), input string(sod_det.sod_raw_days),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fab_days" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fab_days), input string(sod_det.sod_fab_days),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_tax_usage" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_tax_usage, input sod_det.sod_tax_usage,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_rbkt_days" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_rbkt_days), input string(sod_det.sod_rbkt_days),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_rbkt_weeks" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_rbkt_weeks), input string(sod_det.sod_rbkt_weeks),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_rbkt_mths" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_rbkt_mths), input string(sod_det.sod_rbkt_mths),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sched_chgd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sched_chgd), input string(sod_det.sod_sched_chgd),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pastdue" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_pastdue, input sod_det.sod_pastdue,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fix_pr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fix_pr), input string(sod_det.sod_fix_pr),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_wt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fr_wt), input string(sod_det.sod_fr_wt),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_wt_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_fr_wt_um, input sod_det.sod_fr_wt_um,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_class" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_fr_class, input sod_det.sod_fr_class,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_chg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fr_chg), input string(sod_det.sod_fr_chg),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sa_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_sa_nbr, input sod_det.sod_sa_nbr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_isb_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_isb_loc, input sod_det.sod_isb_loc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ship" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_ship, input sod_det.sod_ship,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_auto_ins" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_auto_ins), input string(sod_det.sod_auto_ins),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_drp_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_drp_ref, input sod_det.sod_drp_ref,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_tax_env" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_tax_env, input sod_det.sod_tax_env,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_upd_isb" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_upd_isb), input string(sod_det.sod_upd_isb),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_isb_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_isb_ref), input string(sod_det.sod_isb_ref),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_enduser" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_enduser, input sod_det.sod_enduser,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_crt_int" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_crt_int), input string(sod_det.sod_crt_int),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fr_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_fr_list, input sod_det.sod_fr_list,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pricing_dt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_pricing_dt), input string(sod_det.sod_pricing_dt),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_act_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_act_price), input string(sod_det.sod_act_price),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_covered_amt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_covered_amt), input string(sod_det.sod_covered_amt),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ca_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_ca_nbr, input sod_det.sod_ca_nbr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_fixed_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_fixed_price), input string(sod_det.sod_fixed_price),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_inv_cost" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_inv_cost), input string(sod_det.sod_inv_cost),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_car_load" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_car_load), input string(sod_det.sod_car_load),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ca_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_ca_line), input string(sod_det.sod_ca_line),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_cons" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_cons), input string(sod_det.sod_qty_cons),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_ret" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_ret), input string(sod_det.sod_qty_ret),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_pend" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_pend), input string(sod_det.sod_qty_pend),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_to_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_to_loc, input sod_det.sod_to_loc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_to_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_to_site, input sod_det.sod_to_site,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_to_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_to_ref, input sod_det.sod_to_ref,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ln_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_ln_ref, input sod_det.sod_ln_ref,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_exch" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_exch), input string(sod_det.sod_qty_exch),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sad_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_sad_line), input string(sod_det.sod_sad_line),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_warr_start" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_warr_start), input string(sod_det.sod_warr_start),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_mod_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_mod_userid, input sod_det.sod_mod_userid,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_mod_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_mod_date), input string(sod_det.sod_mod_date),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sv_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_sv_code, input sod_det.sod_sv_code,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_alt_pkg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_alt_pkg), input string(sod_det.sod_alt_pkg),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_for_serial" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_for_serial, input sod_det.sod_for_serial,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_override_lmt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_override_lmt), input string(sod_det.sod_override_lmt),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadc01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__qadc01, input sod_det.sod__qadc01,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadc02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__qadc02, input sod_det.sod__qadc02,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadc03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__qadc03, input sod_det.sod__qadc03,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadc04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod__qadc04, input sod_det.sod__qadc04,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadt01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadt01), input string(sod_det.sod__qadt01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadt02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadt02), input string(sod_det.sod__qadt02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadt03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadt03), input string(sod_det.sod__qadt03),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadt04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadt04), input string(sod_det.sod__qadt04),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadd01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadd01), input string(sod_det.sod__qadd01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadd02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadd02), input string(sod_det.sod__qadd02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadd03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadd03), input string(sod_det.sod__qadd03),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadl01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadl01), input string(sod_det.sod__qadl01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadl02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadl02), input string(sod_det.sod__qadl02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadl03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadl03), input string(sod_det.sod__qadl03),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadi01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadi01), input string(sod_det.sod__qadi01),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadi02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadi02), input string(sod_det.sod__qadi02),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_bonus" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_bonus), input string(sod_det.sod_bonus),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_btb_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_btb_type, input sod_det.sod_btb_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_btb_po" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_btb_po, input sod_det.sod_btb_po,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_btb_pod_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_btb_pod_line), input string(sod_det.sod_btb_pod_line),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_btb_vend" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_btb_vend, input sod_det.sod_btb_vend,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_exp_del" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_exp_del), input string(sod_det.sod_exp_del),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dir_all" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_dir_all), input string(sod_det.sod_dir_all),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cfg_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_cfg_type, input sod_det.sod_cfg_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_div" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_div, input sod_det.sod_div,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_pl_priority" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_pl_priority), input string(sod_det.sod_pl_priority),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_prig1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_prig1, input sod_det.sod_prig1,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_prig2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_prig2, input sod_det.sod_prig2,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod__qadd04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod__qadd04), input string(sod_det.sod__qadd04),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_sub" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_sub, input sod_det.sod_sub,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dsc_sub" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_dsc_sub, input sod_det.sod_dsc_sub,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_dsc_project" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_dsc_project, input sod_det.sod_dsc_project,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_qty_ivcd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_qty_ivcd), input string(sod_det.sod_qty_ivcd),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_cum_time[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_cum_time[1]), input string(sod_det.sod_cum_time[1]),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_ship_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_ship_part, input sod_det.sod_ship_part,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_promise_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_promise_date), input string(sod_det.sod_promise_date),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_charge_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_charge_type, input sod_det.sod_charge_type,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_order_category" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_order_category, input sod_det.sod_order_category,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_modelyr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_modelyr, input sod_det.sod_modelyr,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_custref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_custref, input sod_det.sod_custref,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_consignment" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_consignment), input string(sod_det.sod_consignment),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_max_aging_days" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_max_aging_days), input string(sod_det.sod_max_aging_days),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_consign_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_consign_loc, input sod_det.sod_consign_loc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_intrans_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_sod_det.sod_intrans_loc, input sod_det.sod_intrans_loc,
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_auto_replenish" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_auto_replenish), input string(sod_det.sod_auto_replenish),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

            when "sod_manual_fr_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_sod_det.sod_manual_fr_list), input string(sod_det.sod_manual_fr_list),
                    input recid(sod_det), input sod_det.sod_nbr, input sod_det.sod_line, input "", input "",
                    input "", input "", input "", input "").

        end.

    end.
end.

{hkdttrans.i}
